<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Demo</title>
  <style>
  #paper {
    position: relative;
  }
  </style>
  <script src="https://s2.ssl.qhres.com/!87edaa34/animator-0.3.1.min.js"></script>
</head>
<body>
  <div id="container"></div>
  <script src="/js/spritejs.js"></script>
  <script>
  (async function(){
    const paper = spritejs.Paper2D('#container', 600, 400)
    const Sprite = spritejs.Sprite,
          Label = spritejs.Label

    let res = await paper.preload(
      ['images/birds.png', 'images/birds.json'],
    )

    console.log(res)

    const s = new Sprite()
    
    s.attr({
      anchor: [0.5, 0.5],
      pos: [200, 200],
      size: [43, 30],
      zIndex: 200,
      textures: [{id: 'bird1.png'/*, rect: [0,0,100,100]*/}],
    })  

    paper.layer().appendChild(s)

    s.animate([
      {textures: 'bird1.png'},
      {textures: 'bird2.png'},
      {textures: 'bird3.png'},
      //{textures: 'bird1.png'},
    ], {
      duration: 300,
      direction: 'alternate',
      iterations: Infinity,
      //easing: 'step-end',
      //fill: 'both'
    })

    //s.attr('textures', 'bird3.png')
    window.s = s
  })()
  </script>
</body>
</html>